package edu.sctu.wangfuxin.day20150614.testfile;

import java.io.File;
import java.io.IOException;

/**
 * Created by user06 on 2015/6/14.
 */
public class TestFile {


    public File crateFile(String string) {
        File file = new File(string);
        if (!file.exists()) {                // boolean esists() 方法测试此抽象路径名表示的文件或目录是否存在。
            file.mkdirs();
        }
        return file;
    }

    public boolean crateNewFile(String string) {
        File file = new File(string);
        if (!file.exists()) {
            try {
                return file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return false;
    }

    public boolean deleteFile(String string) {
        File file = new File(string);
        if (file.exists()) {
            return file.delete();
        }
        return false;
    }


}
